package com.sctvcloud.renhe.ui.adapter.holder;

import android.content.Context;
import android.text.Html;
import android.view.View;
import android.widget.TextView;

import com.ruihang.generalibrary.utils.DateUtils;
import com.sctvcloud.renhe.R;
import com.sctvcloud.renhe.beans.ConvertRecordBean;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * Created by Liuyu on 2018/8/17.
 */

public class ConvertRecordHolder extends BaseAbsHolder<ConvertRecordBean> {

    @BindView(R.id.item_record_name)
    protected TextView tvName;

    @BindView(R.id.item_record_count)
    protected TextView tvCount;
    @BindView(R.id.item_record_date)
    protected TextView tvDate;
    @BindView(R.id.item_record_integral)
    protected TextView tvIntegral;
    @BindView(R.id.item_record_divider)
    protected View divider;

    public ConvertRecordHolder(Context context, View itemView) {
        super(context, itemView);
    }

    @Override
    protected void initInject() {
        ButterKnife.bind(this, itemView);
    }

    @Override
    public void setData(ConvertRecordBean crb) {
        if (crb == null) {
            return;
        }
        String countColor =crb.getCommName()+" "+"<font color='#989898'>x" + crb.getCount() + "</font>";
        tvName.setText(Html.fromHtml(countColor));
//        tvCount.setText();
        tvDate.setText(crb.getTime());
        tvIntegral.setText(context.getString(R.string.consume_integral_f, crb.getIntegral()));
    }

    public void setOther(boolean b) {
        divider.setVisibility(b ? View.INVISIBLE : View.VISIBLE);
    }

}
